CREATE PROCEDURE coreWFDefinitionsSave
(
	@id				int output,
	@HandlerCode	nvarchar(50),
	@DefName		nvarchar(500)
)
AS
BEGIN

	IF @id = -1
	BEGIN
		SET NOCOUNT ON;
		INSERT INTO WFDefinitions ( HandlerCodeID, DefName ) VALUES ( @HandlerCode, @DefName );
		SET NOCOUNT OFF;
		SELECT @id = @@IDENTITY;
	END
	ELSE
	BEGIN
		UPDATE WFDefinitions SET DefName=@DefName WHERE PK_ID=@id;
	END
	
END
